package com.wva.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConversionException;

/**
 * @Author: hong
 * @Date: 2025/2/26 21:01:31
 */
@Slf4j
public class CustomJackson2JsonMessageConverter extends Jackson2JsonMessageConverter {
    public CustomJackson2JsonMessageConverter() {
        super();
    }

    @Override
    public Object fromMessage(Message message) throws MessageConversionException {
        message.getMessageProperties().setContentType("application/json");
        Object obj = super.fromMessage(message);
        System.out.println(obj);
        System.out.println(obj.getClass());
        return obj;
    }
}
